<?php
/*
    Copyright (C) 2008 - 2010 Inanta Martsanto
    
    This file is part of Koma.

    Koma is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Koma is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Koma.  If not, see <http://www.gnu.org/licenses/>.
    
    Inanta Martsanto (inanta@inationsoft.com)
*/

define('UNABLE_TO_CONNECT', 0);
define('UNABLE_TO_ACCESS', 1);
define('UNABLE_TO_USE', 2);

class KomaDatabaseException extends KomaException
{
	function __construct($args)
	{
		switch ($args['code'])
		{
			case UNABLE_TO_CONNECT:
				$message = sprintf(T_('Unable to connect to server host [%s]'), $args['host']);
				break;
                        case UNABLE_TO_ACCESS:
                                $message = sprintf(T_('Access denied for user [%s] to database [%s]'), $args['user'], $args['database']);
                                break;
			case UNABLE_TO_USE:
				$message = sprintf(T_('Unable to select or open database [%s]'), $args['database']);
				break;
			default:
				$message = T_('Unknown database error');
		}
		
		parent::__construct($message);
	}
}
?>